package thinkinjava4.ch10.controller;

public class GreenhouseController {
    public static void main(String[] args) {
        GreenhouseControls gc = new GreenhouseControls();
        gc.addEvent(gc.new Bell(3 * Controller.TIME_OFFSET));
        Event[] eventList = {
                gc.new ThermostatNight(0),
                gc.new LightOn(2 * Controller.TIME_OFFSET),
                gc.new LightOff(4 * Controller.TIME_OFFSET),
                gc.new WaterOn(6 * Controller.TIME_OFFSET),
                gc.new WaterOff(8* Controller.TIME_OFFSET),
                gc.new ThermostatDay(9 * Controller.TIME_OFFSET)
        };
        gc.addEvent(gc.new Restart(10 * Controller.TIME_OFFSET, eventList));
        if (args.length == 1)
            gc.addEvent(new GreenhouseControls.Terminate(new Integer(args[0])));
        gc.run();
    }
}
